- Each cell can take on the value 0 or 1.
- Each time-step or generation all of the cells can take on a new value.
- The value of a cell at time T+1 is determined by the values of the cell and
its neighbors at time T.
- The transitions are specified in a transition table.
- Here is one based
on the sum of the values of the cell and its two nearest neighbors on each side:
**Sum****Example****New Value**5 11 **1**110 4 11 **1**011 3 01 **1**010 2 10 **0**011 1 01 **0**000 0 00 **0**000 - Transition tables can be encoded into single numbers
- the above transition table is code 20 rule:
= 5 = 4 = 3 = 2 = 1 = 0 0 * 32 + 1 * 16 + 0 * 8 + 1 * 4 + 0 * 2 + 0 * 1 = 20

- the above transition table is code 20 rule:

*above tables based on*Introduction to Artificial Life, Christoph Adami, 1998 - Here is one based
on the sum of the values of the cell and its two nearest neighbors on each side:

- Class I -
*limit point*behavior- evolve to a homogeneous state (all zeros or all ones)
- example: code 60 rule
- Black represents value 1, white represents value 0.
- Generations/Time increases downwards.

- Class II -
*limit cycle*behavior- evolve periodic structures
- example: code 56 rule

- Class III -
*aperiodic, chaotic*behavior- example: code 10 rule

- example: code 10 rule
- Class IV -
*complex*behavior- appears to self-organize
- may be capable of universal computation (like a Turing machine)
- example: code 20 rule
note that since the array of cells is randomly initialized, each run gives a different result:

He sees this pattern in many areas of nature, such as pigmentation on seashells. He believes cellular automata are the key to understanding how simple rules produce complex structures and behavior.

Many other variations on cellular automata have been studied:

- Other types of transition tables can be used.
- Cells may take on more states than the simple 1/0 on/off.
- The automata may use two or more dimensions
- The most famous two-dimensional cellular automata is Conway's Life
- do a Google search on Conway Life Java to find working Java applets.

- The most famous two-dimensional cellular automata is Conway's Life

def updateForSum(sum,rule): mask = 1 << sum if (rule & mask) != 0: return 1 else: return 0You don't have to understand how this function works to use it, but here's an explanation.

The rules codes can be represented as binary numbers instead of decimal.

- from the transition table above, rule code 20 becomes 010100

- << left shifts the value 1 as many times as the sum.
- & bitwise
`and`

s the mask with the rule.

*Yes, if you don't know binary arithmetic this explanation probably doesn't help.
Try
this site
and
this one
if you want to know more.*

- The program will repeatedly prompt the user for the rule code, and generate the display.

- Build it up from an empty list using the
`append`

method from the previous homework - Initialize each cell with a random value 0 or 1.

`plot`

function:
livewires.plot(x,y)To calculate a new generation, first copy the list to a temporary list.

- For each cell in the temporary list sum its current value with that of its two
closest neighbors on each side, and call
`updateForSum`

to determine the new value. - Be sure to handle the neighbor-does-not-exist cases (near the list ends).

- display the new current list one line down
- repeat for height of display window

Don't forget to call `livewires.clear_screen()`

when you start to
display a new code rule.

Also, the drawable area of the livewires display window appears to be a few pixels shorter than the requested height. Try leaving a few blank lines at the top to ensure you are displaying all the data (the first line should always look random).

When your program is working, try out different code rules. You may even find one that impresses Stephen.